using FluentNHibernate.Mapping;
using Wikey.Entity;

namespace Wikey.Domain.Mappings
{
    public class UserMap : ClassMap<User> {

        public UserMap() {
            Id(x => x.Id);
            Map(x => x.Name).Not.Nullable().Length(30);
            Map(x => x.Picture).Nullable().Length(200);
            Map(x => x.Bio).Nullable().Length(1000);
            Component(x => x.Credential, credentials =>
            {
                credentials.Map(c => c.Username).Not.Nullable().Length(50);
                credentials.Map(c => c.Password).Not.Nullable().Length(100);
                credentials.Map(c => c.Email).Not.Nullable().Length(100);
            });
            Not.LazyLoad();
        }
    }
}